// u阿斯顿
/*
你好h*/
int sum(int n) {
    int a = 0, b = 0;
    for (;a<n;a=a+1) {
        b = a+b;
    }
    return b;
}

char add_char(char a,char b,char c,char d,char e, char f) {
    return a+b+c+d+e+f;
}

short add_short(short a, short b, short c, short d, short e, short f) {
    return a+b+c+d+e+f;
}

int add_int(int a,int b,int c,int d,int e, int f) {
    return a+b+c+d+e+f;
}

long add_long(long a, long b, long c, long d, long e, long f) {
    return a+b+c+d+e+f;
}

int sub() {
    return 2 - 1;
}

int fib(int n) {
    if (n <= 1) {
        return 1;
    }
    return fib(n - 1) * n;
}

int test06() {
    int a = 3;
    int b = sizeof a;
    return b;
}

int test07() {
    int a = 3;
    int *b = &a;
    return sizeof b;
}

int testTypeChar() {
    char x;
    return sizeof x;
}
int testTypeShort() {
    short x;
    return sizeof x;
}
int testTypeInt() {
    int x;
    return sizeof x;
}
int testTypeLong() {
    long x;
    return sizeof x;
}

// 以char*访问int
int testType01() {
    int x = 4567456745;
    char *p = &x;
    return *(p);
}
int testType02() {
    int x = 4567456745;
    char *p = &x;
    return *(p+1);
}
int testType03() {
    int x = 4567456745;
    char *p = &x;
    return *(p+2);
}
int testType04() {
    int x = 4567456745;
    char *p = &x;
    return *(p+3);
}


int main() {
    assert(3, sum(3));
    assert(6, sum(4));
    assert(1+2+3+4+5+6, add_char(1,2,3,4,5,6));
    assert(1+2+3+4+5+6, add_short(1,2,3,4,5,6));
    assert(1+2+3+4+5+6, add_int(1,2,3,4,5,6));
    assert(1+2+3+4+5+6, add_long(1,2,3,4,5,6));
    assert(1, sub());
    assert(120, fib(5));
    assert(-1, 1 - 2);
    assert(4, test06());
    assert(8, sizeof 8);
    assert(8, test07());

    assert(1, testTypeChar());
    assert(2, testTypeShort());
    assert(4, testTypeInt());
    assert(8, testTypeLong());

    assert(-23, testType01());
    assert(-37, testType02());
    assert(61, testType03());
    assert(16, testType04());
}